package cn.iocoder.yudao.module.wrzj.dal.mysql.conversation;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wrzj.dal.dataobject.conversation.ConversationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wrzj.controller.app.conversation.vo.*;

/**
 * chatbase会话记录 Mapper
 *
 * @author 运掌科技
 */
@Mapper
public interface ConversationMapper extends BaseMapperX<ConversationDO> {

    default PageResult<ConversationDO> selectPage(AppConversationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ConversationDO>()
                .eqIfPresent(ConversationDO::getConversationId, reqVO.getConversationId())
                .eqIfPresent(ConversationDO::getUid, reqVO.getUid())
                .eqIfPresent(ConversationDO::getContent, reqVO.getContent())
                .eqIfPresent(ConversationDO::getRole, reqVO.getRole())
                .eqIfPresent(ConversationDO::getChatbotId, reqVO.getChatbotId())
                .betweenIfPresent(ConversationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ConversationDO::getId));
    }

}